package top.mataiji.manager.util;

/**
 * @Auther: zhaoss
 * @Date: 2021/3/22 - 03 - 22 - 11:07
 * @Description: top.mataiji.config.util
 * @version: 1.0
 */
public class Result<T> {

    private String flag;

    private String message;

    private T data;

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    //返回成功对象
    public static Result success(String message){
        Result result = new Result("success",message);
        return result;
    }

    //返回成功对象
    public static <T> Result<T> success(String message, T t){
        Result result = new Result("success",message);
        result.setData(t);
        return result;
    }

    //返回失败对象
    public static Result error(String message){
        Result result = new Result("error",message);
        return result;
    }

    private Result(String flag, String message) {
        this.flag = flag;
        this.message = message;
    }

    public Result() {
    }

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
